import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/components/home'

Vue.use(Router)

export default new Router({
  mode: 'history',  //history去掉#号
  routes: [
    {
      path: '/',
      redirect: '/home',  //重定向redirect
      hidden:true
    }, 
    {
      path: '/',
      name: '',
      // component: () => import('@/components/HelloWorld')     
      component: Home,
      iconCls: 'el-icon-s-home',
      leaf: true,//只有一个节点
      children: [
        { 
          path: '/home',
          name: '首页' ,
          iconCls: 'el-icon-menu',
          component: resolve => require(['@/view/home'], resolve)
        }
      ]
    },
    {
      path: '/',
      name: '',
      // component: () => import('@/components/HelloWorld')     
      component: Home,
      iconCls: 'el-icon-s-home',
      leaf: true,//只有一个节点
      children: [
        { 
          path: '/test',
          name: '测试页面' ,
          iconCls: 'el-icon-menu',
          component: resolve => require(['@/view/test'], resolve)
        }
      ]
    },
    {
      path: '/',
      name: 'JS',
      iconCls: 'el-icon-paperclip',
      component: Home,
      children: [
        { 
          path: '/jsClass',
          name: 'js类' ,
          component: resolve => require(['@/view/jsClass'], resolve)
        }
      ]
    },
    {
      path: '/',
      name: 'VUE类',
      // component: () => import('@/components/HelloWorld')     
      component: Home,
      iconCls: 'el-icon-eleme',
      children: [
        { 
          path: '/jsx',
          name: 'JSX功能' ,
          component: resolve => require(['@/view/jsx'], resolve)
        },
        { 
          path: '/props',
          name: '组件props' ,
          component: resolve => require(['@/view/props'], resolve)
        },
        { 
          path: '/popUp',
          name: '弹窗拖动' ,
          component: resolve => require(['@/view/popUp'], resolve)
        }
      ]
    },
    {
      path: '/',
      name: '列表组件',      
      component: Home,
      iconCls: 'el-icon-menu',
      children: [
        { 
          path: '/table1',
          name: 'table列表1' ,
          component: resolve => require(['@/view/table'], resolve),
          hidden:true  //隐藏菜单
        },
        { 
          path: '/table',
          name: 'table列表' ,
          component: resolve => require(['@/view/table'], resolve)
        },
        { 
          path: '/tablePack',
          name: '列表封装' ,
          component: resolve => require(['@/view/tablePack'], resolve)
        },
        
        { 
          path: '/details',
          name: 'details详情' ,
          component: resolve => require(['@/view/details'], resolve)
        }
      ]
    },
    {
      path: '/',
      name: "element踩坑",      
      component: Home,
      iconCls: 'el-icon-document',
      children: [
        { 
          path: '/form',
          name: 'form表单验证' ,
          component: resolve => require(['@/view/form'], resolve)
        },
        { 
          path: '/formVerify',
          name: 'form表单自定义验证' ,
          component: resolve => require(['@/view/formVerify'], resolve)
        }
      ]
    },
    {
      path: '/',
      name: '插件',
      iconCls: 'el-icon-paperclip',
      component: Home,
      children: [
        { 
          path: '/vueQrCopy',
          name: '二维码+复制' ,
          component: resolve => require(['@/view/vueQrCopy'], resolve) 
        },
        { 
          path: '/vuedraggable',
          name: '拖动排序' ,
          component: resolve => require(['@/view/vuedraggable'], resolve)
        },
        { 
          path: '/quill',
          name: '富文本框' ,
          component: resolve => require(['@/view/quill'], resolve)
        },
        { 
          path: '/wangEditor',
          name: 'wangEditor富文本框' ,
          component: resolve => require(['@/view/wangEditor'], resolve)
        }
      ]
    },
    {
      path: '/',
      name: 'VUEX',
      iconCls: 'el-icon-paperclip',
      component: Home,
      children: [
        { 
          path: '/vuexDemo',
          name: 'vuex演示' ,
          component: resolve => require(['@/view/vuex/vuexDemo'], resolve)
        },
        { 
          path: '/vueX',
          name: 'vuex优化写法' ,
          component: resolve => require(['@/view/vuex/vueX'], resolve)
        },
        { 
          path: '/vueXmodule',
          name: 'vuex模块化' ,
          component: resolve => require(['@/view/vuex/vueXmodule'], resolve)
        }
      ]
    },
    {
      path: '/',
      name: 'CSS',
      iconCls: 'el-icon-picture-outline-round',
      component: Home,
      children: [
        { 
          path: '/css',
          name: 'CSS变量' ,
          component: resolve => require(['@/view/css'], resolve)
        },
        { 
          path: '/cssScreen',
          name: '响应式' ,
          component: resolve => require(['@/view/cssScreen'], resolve)
        }        
      ]
    },
    {
      path:"/",
      name:"canvas",
      iconCls: 'el-icon-picture',
      component: Home,
      children:[
        { 
          path: '/canvasTailoring',
          name: 'canvas裁剪' ,
          component: resolve => require(['@/view/canvasTailoring'], resolve)
        }
      ]
    },
    {
      path:"/",
      name:"",
      iconCls: 'el-icon-location',
      component: Home,
      leaf: true,//只有一个节点
      children:[
        { 
          path: '/address',
          name: '技术常用网站' ,
          component: resolve => require(['@/view/address'], resolve)
        }
      ]
    },
    {
      path:"/",
      name:"",
      iconCls: 'el-icon-location',
      component: Home,
      leaf: true,//只有一个节点
      children:[
        { 
          path: '/www',
          name: '我的网站' ,
          component: resolve => require(['@/view/www'], resolve)
        }
      ]
    }
  ]
})
